WP-CLI is a tool that allows you to manage WordPress installations on your server from the command line. It can be very handy for efficient management of multiple WordPress installations. This guide assumes that you have already installed WordPress on a LAMP stack.
WP-CLI comes pre-installed on the Dekopon Stack One-Click WordPress app.
Before we can actually use WP-CLI to manage WordPress, we need to install it:
cd ~
curl -k -L https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > wp-cli.phar
Test it:
php wp-cli.phar --info
This will display PHP information.
~/.bashrc
In order for the wp
command to work, we need to alter our ~/.bashrc
file. Open it, and add the following line:
alias wp="php /home/USERNAME/wp-cli.phar"
Now reload the file:
source ~/.bashrc
In order to use WP-CLI, navigate to the folder that contains your WordPress installation. You can now use WP-CLI commands in that folder. For example, try updating your WordPress installation with the following command:
wp core update
For a full list of WP-CLI commands, see the documentation on the official site.